<!-- 评论组件 -->
<template>
	<div class="app">
		<div class="title">
			<h2>提交评论</h2>
		</div>

		<div class="postcomment">
			<textarea ref="commentContent" placeholder="请输入要评论的内容.."></textarea>
			<mt-button type="danger" size="large" @click="sendMessage">发表</mt-button>
		</div>

		<div class="list">
			<h3>评论列表</h3>
			<ul>
				<li v-for="item in comments" >
					{{item}}
				</li>
			</ul>
			<!--<mt-button type="danger" size="large" @click="getMore">加载更多....</mt-button>-->
		</div>

	</div>
</template>

<script>
//import common from '../../kits/common.js';
import { Toast } from 'mint-ui';

import {setItem,getObj} from './location.js';

export default{
	data(){
		return {
			comments:[],
		}
	},
	props:['conmentid'],
	methods:{
		// 1.0 提交评论
		sendMessage(){
			// // 1.0 获取提交内容
			var conmentid=this.conmentid
			var txt = this.$refs.commentContent.value;
			setItem({movieId:conmentid,content:txt});
			// 	清除文本框内容
			this.$refs.commentContent.value = '';
			this.comments=[];
			this.showconment();
		},
		// 2.0 获取评论
		getMessage(){
			
			getObj(this.conmentid);
		},
		showconment(){
			var getContent=getObj(this.conmentid);
			this.comments = this.comments.concat(getContent)
		}
	},
	created(){
		this.showconment();
	}
}
	
</script>

<style scoped>
	.title{
		border-bottom: 1px solid rgba(0,0,0,0.4);
	}

	.postcomment{
		margin-top: 5px;
		padding: 5px;
	}

</style>